# Try to find the libmemcached
#
# LIBMEMCACHED_FOUND       - system has the libmemcached library
# LIBMEMCACHED_INCLUDE_DIR - the libmemcached include directory
# LIBMEMCACHED_LIBRARIES   - The libraries needed to use libmemcached

IF (LIBMEMCACHED_INCLUDE_DIRS)
  # Already in cache, be silent
  SET(LIBMEMCACHED_FIND_QUIETLY TRUE)
ENDIF ()

FIND_PATH(LIBMEMCACHED_INCLUDE_DIR libmemcached/memcached.h)

FIND_LIBRARY(LIBMEMCACHED_LIBRARY memcached)

# handle the QUIETLY and REQUIRED arguments and set Libmemcached_FOUND to TRUE if 
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Libmemcached DEFAULT_MSG LIBMEMCACHED_LIBRARY LIBMEMCACHED_INCLUDE_DIR)

IF(LIBMEMCACHED_FOUND)
  SET(LIBMEMCACHED_LIBRARIES ${LIBMEMCACHED_LIBRARY})
  SET(LIBMEMCACHED_INCLUDE_DIRS ${LIBMEMCACHED_INCLUDE_DIR})
ELSE()
  SET(LIBMEMCACHED_LIBRARIES)
  SET(LIBMEMCACHED_INCLUDE_DIRS)
ENDIF()

MARK_AS_ADVANCED(LIBMEMCACHED_LIBRARIES LIBMEMCACHED_INCLUDE_DIRS)
